<?php
	
	drupal_set_title('');
	$url = $config->getVar('url');
	drupal_add_css('bdbdec/view/css/displayList.css');    
	drupal_add_js('bdbdec/view/scripts/displayList.js');    
	
	
	echo '
	<div id="tabs-wrapper" class="clear-block">
		<h2 class="with-tabs">R&eacute;sultats de la recherche "'.$searchfield.'" (S&eacute;ries)</h2>';
	
	if ($user->isAllowedTo(GRADE_SEARCH_BOOK))
		echo '
		<div class="right">
			<a class="search" ref="#">Recherche rapide</a>
			<div class="searchTabs">
				<form action="'.$url.'/bdbdec.php?action=quickSearch&amp;element=serie" method="post" style="margin:0px;">
					<input type="text" name="searchfield" class="searchfield" />
					<select name="element">
						<option value="book">Album</option>
						<option value="serie" selected="selected">S&eacute;rie</option>
						<option value="publisher">Editeur</option>
						<option value="author">Auteur</option>
					</select>
					<input type="submit" value="Valider"><br />
					<small><a href="'.$url.'/bdbdec.php?action=search">Recherche avanc&eacute;e</a></small>
				</form>
			</div>
		</div>';
		echo '
	</div>
	<table>
		<thead>
			<tr>
				<th>
					<a href="'.$url.'/bdbdec.php?action='.$action.'&amp;element=serie&amp;order=se_name&amp;sens='.$sens.'&amp;link='.$link.'&amp;searchfield='.$searchfield.'">Nom</a>
				</th>
				<th>
					<a href="'.$url.'/bdbdec.php?action='.$action.'&amp;element=serie&amp;order=se_genre&amp;sens='.$sens.'&amp;link='.$link.'&amp;searchfield='.$searchfield.'">Genre</a>
				</th>
				<th>
					<a href="'.$url.'/bdbdec.php?action='.$action.'&amp;element=serie&amp;order=se_stateBDBDEC&amp;sens='.$sens.'&amp;link='.$link.'&amp;searchfield='.$searchfield.'">&Eacute;tat &agrave; la BDBDEC</a>
				</th>
				<th>
					<a href="'.$url.'/bdbdec.php?action='.$action.'&amp;element=serie&amp;order=se_statePublisher&amp;sens='.$sens.'&amp;link='.$link.'&amp;searchfield='.$searchfield.'">&Eacute;tat chez l\'&eacute;diteur</a>
				</th>
				<th>
					<a href="'.$url.'/bdbdec.php?action='.$action.'&amp;element=serie&amp;order=se_type&amp;sens='.$sens.'&amp;link='.$link.'&amp;searchfield='.$searchfield.'">Type</a>    
				</th>
				<th>
					<a href="'.$url.'/bdbdec.php?action='.$action.'&amp;element=serie&amp;order=nb_al&amp;sens='.$sens.'&amp;link='.$link.'&amp;searchfield='.$searchfield.'">Nb tomes</a>    
				</th>
				<th>
					<a href="'.$url.'/bdbdec.php?action='.$action.'&amp;element=serie&amp;order=se_mean&amp;sens='.$sens.'&amp;link='.$link.'&amp;searchfield='.$searchfield.'">Note <sub>/10</sub></a>
				</th>
			</tr>
		</thead>
		<tbody>';
		
		foreach ($elementsList as $serie)
		{
			echo '
			<tr class="highlightable">
				<td>
					<a href="'.$url.'/bdbdec.php?action=viewElement&amp;element=serie&amp;id='.$serie['se_id'].'">'.stripslashes($serie['se_name']).'</a>
				</td>
				<td>
					'.stripslashes($serie['se_genre']).'
				</td>
				<td>
					'.displayState(stripslashes($serie['se_stateBDBDEC'])).'
				</td>
				<td>
					'.displayState(stripslashes($serie['se_statePublisher'])).'
				</td>
				<td>
					'.stripslashes($serie['se_type']).'
				</td>
				<td>
					'.stripslashes($serie['nb_al']).'
				</td>
				<td>';
				if (!is_null($serie['se_mean']))
					echo round($serie['se_mean'],2);
				echo '
				</td>
			</tr>';
		}
		echo '
		</tbody>
	</table>';
	
?>